#include "LinkStack.h"

typedef struct PERSON {
    LinkNode node;
    char name[64];
    int age;
}Person;

int main() {
    LinkStack* stack = Init_LinkStack();

    Person p1,p2,p3,p4,p5;
    strcpy(p1.name,"aaa");
    strcpy(p2.name,"bbb");
    strcpy(p3.name,"ccc");
    strcpy(p4.name,"ddd");
    strcpy(p5.name,"eee");

    p1.age = 18;
    p2.age = 19;
    p3.age = 20;
    p4.age = 21;
    p5.age = 22;

    Push_LinkStack(stack,(LinkNode*)&p1);
    Push_LinkStack(stack,(LinkNode*)&p2);
    Push_LinkStack(stack,(LinkNode*)&p3);
    Push_LinkStack(stack,(LinkNode*)&p4);
    Push_LinkStack(stack,(LinkNode*)&p5);

    while (Size_LinkStack(stack) > 0) {
        //取出栈顶元素
        Person* p = (Person*)Pop_LinkStack(stack);
        printf("Name:%s\tAge:%d\n",p->name,p->age);
    }

    FreeSpace_LinkStack(stack);

    return 0;
}